#Boa:Frame:InicioAplicacion

import wx
import showFotos
import nuevasFotos
import ingresoManual
import utiles

def create(parent):
    return InicioAplicacion(parent)

[wxID_INICIOAPLICACION, wxID_INICIOAPLICACIONBITMAPBUTTON1, 
 wxID_INICIOAPLICACIONBITMAPBUTTON2, wxID_INICIOAPLICACIONBUTTON1, 
 wxID_INICIOAPLICACIONBUTTON2, wxID_INICIOAPLICACIONPANEL1, 
] = [wx.NewId() for _init_ctrls in range(6)]

class InicioAplicacion(wx.Frame):
    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Frame.__init__(self, id=wxID_INICIOAPLICACION,
              name='InicioAplicacion', parent=prnt, pos=wx.Point(231, 53),
              size=wx.Size(802, 598), style=wx.CLOSE_BOX,
              title='Fotografias Sussan')
        self.SetClientSize(wx.Size(794, 571))

        self.panel1 = wx.Panel(id=wxID_INICIOAPLICACIONPANEL1, name='panel1',
              parent=self, pos=wx.Point(0, 0), size=wx.Size(794, 571),
              style=wx.TAB_TRAVERSAL)

        self.button1 = wx.Button(id=wxID_INICIOAPLICACIONBUTTON1,
              label=u'por C\xf3digos', name='button1', parent=self.panel1,
              pos=wx.Point(48, 40), size=wx.Size(696, 80), style=0)
        self.button1.SetFont(wx.Font(26, wx.SWISS, wx.NORMAL, wx.BOLD, False,
              'Tahoma'))
        self.button1.Bind(wx.EVT_BUTTON, self.OnButtonCodigos,
              id=wxID_INICIOAPLICACIONBUTTON1)

        self.button2 = wx.Button(id=wxID_INICIOAPLICACIONBUTTON2,
              label='Asociar Fotos a Productos', name='button2',
              parent=self.panel1, pos=wx.Point(48, 248), size=wx.Size(696, 80),
              style=0)
        self.button2.SetFont(wx.Font(26, wx.SWISS, wx.NORMAL, wx.BOLD, False,
              'Tahoma'))
        self.button2.Bind(wx.EVT_BUTTON, self.OnButtonAsociarFotos,
              id=wxID_INICIOAPLICACIONBUTTON2)

        self.bitmapButton1 = wx.BitmapButton(bitmap=wx.Bitmap(u'botonSalirI3.png',
              wx.BITMAP_TYPE_PNG), id=wxID_INICIOAPLICACIONBITMAPBUTTON1,
              name='bitmapButton1', parent=self.panel1, pos=wx.Point(48, 432),
              size=wx.Size(200, 88), style=wx.BU_AUTODRAW)
        self.bitmapButton1.Bind(wx.EVT_BUTTON, self.OnButtonSalir,
              id=wxID_INICIOAPLICACIONBITMAPBUTTON1)

        self.bitmapButton2 = wx.BitmapButton(bitmap=wx.Bitmap(u'botonApagarI1.png',
              wx.BITMAP_TYPE_PNG), id=wxID_INICIOAPLICACIONBITMAPBUTTON2,
              name='bitmapButton2', parent=self.panel1, pos=wx.Point(544, 432),
              size=wx.Size(200, 88), style=wx.BU_AUTODRAW)
        self.bitmapButton2.Bind(wx.EVT_BUTTON, self.OnButtonApagar,
              id=wxID_INICIOAPLICACIONBITMAPBUTTON2)

    def __init__(self, parent):
        self._init_ctrls(parent)
        self.CenterOnScreen()
        
    def OnButtonSalir(self, event):
        exit()

    def OnButtonApagar(self, event):
        dlg = utiles.dialog2(self, "ESTA SEGURO DE APAGAR EL SISTEMA?")
        if dlg:
            import subprocess
            comando = "shutdown -s -t 0"
            p = subprocess.Popen(comando, shell=True)
            exit()

    def OnButtonCodigos(self, event):
        miFrame = showFotos.showFotos(self)
        miFrame.Show()
        self.Enable(False)
        self.Show(False)

    def OnButtonAsociarFotos(self, event):
##        valor = ""
##        dlg = ingresoManual.Dialog1(self, "")
##        try:
##            dlg.ShowModal()
##            valor = dlg.valor
##        finally:
##            dlg.Destroy()   
##        if valor == "1234":
##            miFrame = nuevasFotos.Frame1(self)
##            miFrame.Show()
##            self.Enable(False)
##            self.Show(False)
##        elif valor != "":
        miFrame = nuevasFotos.Frame1(self)
        miFrame.Show()
        self.Enable(False)
        self.Show(False)

